package program.conditions;

import item.*;

/**
 * A class for dealing with true-conditions: (wall).
 *
 */
public class Wall extends Conditions {
	/**
	 * Initialise this new wall-condition with a line-number.
	 *
	 */
	public Wall(int lineNb) {
		super(lineNb);
	}
	
	/**
	 * Evaluates these conditions for a given robot.
	 *
	 * @return      
	 *         | for one element in robot.getBoard().getElements(robot.getRightNeighbour(robot.getOrientation)) :
	 *         |       result == (Item instanceof item.wall)
	 */
	@Override
	public boolean evaluate(Robot robot) {
		if(!super.evaluate(robot))	return false;
		for(Item item : (robot.getRightNeighbour(robot.getOrientation())).getListOfItemsAtPosition())
			return item instanceof item.Wall;
		return false;
	}
	
	/**
	 * Returns a textual representation of this wall-condition, formatted in accordance with its position in the program.
	 *
	 * @return
	 * 		   | result == getIndentation(indentationLevel) + "(wall)"
	 */
	@Override
	public String prettyFormat(int indentationLevel) {
		return getIndentation(indentationLevel) + "(wall)";
	}
} 
